#pragma once

#include <map>

#include "Error.h"
#include "Object.h"
#include "TypeDef.h"

namespace FlooP
{
	class Scope
	{
		public:

		Scope ();
		Scope (const Scope& copy);

		void define (const std::string& name);
		void define (const std::string& name, std::shared_ptr<Object> object);
		void set (const std::string& name, std::shared_ptr<Object> object);

		void clear ();
		void reset ();

		std::shared_ptr<Object> find (const std::string& name);

		std::shared_ptr<Object> output () const;
		std::shared_ptr<Object> cell (uint32_t num) const;

		void set_output (std::shared_ptr<Object> output);
		void set_cell   (std::shared_ptr<Object> cell, uint32_t num);

		private:

		std::shared_ptr<Object> m_output;
		std::map<uint32_t, std::shared_ptr<Object>> m_cell;
		std::map<std::string, std::shared_ptr<Object>> m_vars;
	};
}